<?php
	require '../config.php';
	require '../inc/require.php';
	
	$chip_id = $_POST['chip_id'];
	$kosten = $_POST['kosten'];
	
	$chip = new Chip();
	$chip = $chip->get($chip_id);
	$chip->credit = $chip->credit - $kosten;
	$chip->save();
	
	foreach($_POST['pictures'] as $picture_id){

		
		$picture = new Picture();
		$picture = $picture->get($picture_id);
		$picture->is_bought = 1;
		$picture->save();
	}

?>